import { Table,Popconfirm,Button } from 'antd';
import React from 'react';
import PropTypes from 'prop-types';

const proList =({onDelete,pro})=>{
  const colums=[{
    title:'name',
    dataIndex:'name'
  },{
    title:'action',
    render:(text,record)=>{
      return (
        <Popconfirm title="Delete?" onConfirm={() => onDelete(record.id)}>
          <Button>Delete</Button>
        </Popconfirm>
      )
    }
  }]
  return (
    <Table
      dataSource={pro}
      columns={colums}
    />
  )
}

proList.propTypes = {
  onDelete: PropTypes.func.isRequired,
  products: PropTypes.array.isRequired,
};
export default proList;
